-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add number of container using image #15741
Add number of container using image #15741
Conversation
@miq-bot add_label providers/containers, bug |
@nimrodshn Cannot apply the following label because they are not recognized: containers/providers |
@miq-bot add_label providers/containers |
4b4b744
to
702b048
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@nimrodshn I think you should restart the testing. Maybe even add a simple test to make sure that this functionality doesn't change by accident in the future. |
@enoodle added tests 👍 |
app/models/container_image.rb
Outdated
@@ -31,9 +31,14 @@ class ContainerImage < ApplicationRecord | |||
|
|||
acts_as_miq_taggable | |||
virtual_column :display_registry, :type => :string | |||
virtual_column :number_of_containers, :type => :integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app/models/container_image.rb
Outdated
|
||
after_create :raise_creation_event | ||
|
||
def number_of_containers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a simple count you can use virtual_total
, no need for virtual_column
with custom method. Naming: there is a convention of total_containers
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cben but for a report I think I need it as a column, keep me honest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind this property is used in a report.
702b048
to
c2298f9
Compare
@cben changed to |
c2298f9
to
df8d442
Compare
app/models/container_image.rb
Outdated
@@ -31,6 +31,7 @@ class ContainerImage < ApplicationRecord | |||
|
|||
acts_as_miq_taggable | |||
virtual_column :display_registry, :type => :string | |||
virtual_total :containers_count, :containers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beni indeed I see there is a stronger convention toward total_containers
@nimrodshn can you please rename (again ¯_(ツ)_/¯)
df8d442
to
b1bd6d0
Compare
@moolitayer fixed 👍 |
expect(FactoryGirl.create( | ||
:container_image, | ||
:containers => [FactoryGirl.create(:container, :name => "container_a", :container_group => group), | ||
FactoryGirl.create(:container, :name => "container_b", :container_group => group)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:containers => FactoryGirl.create_list(:container, :container_group => group)
You will probably need to add a sequence definition in the container factory.
82b1d33
to
d190e52
Compare
@@ -0,0 +1,13 @@ | |||
describe ContainerImage do | |||
it "containers count" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it "counts containers" do
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea 👍
d190e52
to
58dcedb
Compare
@enoodle , @moolitayer fixed 👍 |
1
Outdated
@@ -0,0 +1,21 @@ | |||
pick 82b1d33 add number of container using image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file please and I'm good
58dcedb
to
b04db6b
Compare
@moolitayer fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nimrodshn
LGTM 👍
@gtanzillo @lpichler I use this |
please rebase (the "test saver strategies" commit should disappear) and squash "removed random file" commit. |
some refactoring refactored containers count minor refactoring minor refactoring refactored tests refactored tests refactored tests added file by mistake removed random file
61b6d04
to
140d1aa
Compare
@cben Thanks! fixed 😃 |
Checked commit nimrodshn@140d1aa with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screenshot of a report please
@zeari screenshot at the top ⬆️ |
❤️ awesome @nimrodshn |
This is to support adding
Number of Containers
column to theContainerImage
list view.BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1474094
Screenshot of report :
cc: @enoodle @Loicavenel
@simon3z